import React, {Component} from 'react'
import './style.scss'
import config from './config/default'
import LoginContainer from '../../components/login'
import RegisterContainer from '../../components/register'

require('particles.js')

class Login extends Component {
    constructor(props) {
        super(props)
        this.state = {
            resgister: true
        }
    }

    render() {
        return (
            <div id='container' className='container'>
                <div className='login'>
                    <p> {this.state.resgister}</p>
                    {
                        this.state.resgister
                            ?
                            <LoginContainer handleResgister={this.handleResgaster.bind(this)}/>
                            :
                            <RegisterContainer handleResgister={this.handleResgaster.bind(this)}/>}
                </div>
            </div>
        )
    }

    handleResgaster(val) {
        this.setState({
            resgister: val
        })
    }


    componentDidMount() {
        window.particlesJS('container', config)
    }
}

export default Login